package br.edu.ufcg.lsd.wbis.ui.client.ui.loggedin.admin.uppermenu;

import br.edu.ufcg.lsd.wbis.ui.client.ui.loggedin.LogoutButtonListener;
import br.edu.ufcg.lsd.wbis.ui.client.ui.loggedin.admin.CenterPanel;
import br.edu.ufcg.lsd.wbis.ui.client.ui.loggedin.admin.uppermenu.equipment.EquipmentToolbarButton;
import br.edu.ufcg.lsd.wbis.ui.client.ui.loggedin.admin.uppermenu.user.UserToolbarButton;
import br.edu.ufcg.lsd.wbis.ui.client.ui.loggedin.util.locking.LockButtonListener;
import br.edu.ufcg.lsd.wbis.ui.client.ui.management.PanelManager;

import com.gwtext.client.widgets.Toolbar;
import com.gwtext.client.widgets.ToolbarButton;

/**
 * @author Renato Miceli
 */
public class UpperPanel extends Toolbar {

	public UpperPanel(final PanelManager panelManager, CenterPanel centerPanel) {

		this.addButton(new UserToolbarButton(centerPanel, panelManager.getInfoManager()));
		this.addSpacer();
		this.addButton(new EquipmentToolbarButton(centerPanel, panelManager.getInfoManager()));
		this.addFill();
		this.addText("Logged as " + panelManager.getInfoManager().getInfo().getLogin());
		this.addSeparator();
		this.addButton(new ToolbarButton("Lock", new LockButtonListener(panelManager)));
		this.addSeparator();
		this.addButton(new ToolbarButton("Logout", new LogoutButtonListener(panelManager)));
	}

}
